// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env : 'cloud2012-9gl0qd6g8dc72b1c'
})

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  let openid = wxContext.OPENID;
  // 通过openid查询数据库
  let db = cloud.database();
  return await db.collection('xzyy_user').where({
    "_openid": openid
  }).get()
  
}